package Ontologies;

import jade.content.Concept;

import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: jiakai.lian
 * Date: 13-5-9
 * Time: 10:51 PM
 *
 * the entity class for tree
 */
public class TreeWithPrice implements Concept {
    private String commonName; /** the common name of the tree */
    private String latinName; /** the latin name of the tree */
    private String category;  /** the category of the tree */
    private float unitPrice; /** the unit price of the tree */
    private int quantity; /** the quantity of the tree */

    /**
     * construct of the class
     *
     * @param  commonName: the common name of the tree
     * @param  latinName : the latin name of the tree
     * @param  category : the category of the tree
     * @param  unitPrice : the unit price of the tree
     * @param  quantity    : the quantity of the tree
     */
    public TreeWithPrice(String commonName, String latinName, String category, float unitPrice, int quantity) {
        this.commonName = commonName;
        this.latinName = latinName;
        this.category = category;
        this.unitPrice = unitPrice;
        this.quantity = quantity;
    }

/**
 * construct a new tree by another tree
 *
 * @param  tree: the original tree
 */
    public TreeWithPrice(TreeWithPrice tree) {
        this.commonName = tree.commonName;
        this.latinName = tree.latinName;
        this.category = tree.category;
        this.unitPrice = tree.unitPrice;
        this.quantity = tree.quantity;
    }

    /**
     * default constructor
     */
    public TreeWithPrice() {
        this.unitPrice = -1;
        this.quantity = -1;
    }

    public String getCategory() {

        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    @Override
    public String toString() {
        return "Tree{" +
                "commonName='" + commonName + '\'' +
                ", latinName='" + latinName + '\'' +
                ", unitPrice=" + unitPrice +
                ", quantity=" + quantity +
                '}';
    }

    public String getCommonName() {
        return commonName;
    }

    public void setCommonName(String commonName) {
        this.commonName = commonName;
    }

    public String getLatinName() {
        return latinName;
    }

    public void setLatinName(String latinName) {
        this.latinName = latinName;
    }

    public float getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(float unitPrice) {
        this.unitPrice = unitPrice;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof TreeWithPrice)) return false;

        TreeWithPrice that = (TreeWithPrice) o;

        if (commonName != null ? !commonName.equals(that.commonName) : that.commonName != null) return false;
        if (latinName != null ? !latinName.equals(that.latinName) : that.latinName != null) return false;

        return true;
    }

}
